/**
 * 
 */
package image;

/**
 * @author nquangtrung
 *
 */
public class RGBColor {
	public static final int RED_MASK 	= 0x00FF0000;
	public static final int GREEN_MASK 	= 0x0000FF00;
	public static final int BLUE_MASK 	= 0x000000FF;

	private int red;
	private int green;
	private int blue;
	
	public RGBColor(int r, int g, int b) {
		this.setRed(r);
		this.setGreen(g);
		this.setBlue(b);
	}
	
	public void setRed(int red) {
		if (red < 0) red = 256 + red;
		if (red > 255) red = red % 256;
		
		this.red = red;
	}
	public void setGreen(int green) {
		if (green < 0) green = 256 + green;
		if (green > 255) green = green % 256;
		
		this.green = green;
	}
	public void setBlue(int blue) {
		if (blue < 0) blue = 256 + blue;
		if (blue > 255) blue = blue % 256;
		
		this.blue = blue;
	}
	
	public int getRed() {
		return this.red;
	}
	public int getGreen() {
		return this.green;
	}
	public int getBlue() {
		return this.blue;
	}
}
